Skip to content

Support default type parameters in Generic - #795

Open
GruffElixir wants to merge 3 commits into
python:mainfrom
GruffElixir:fix/typevar-defaults
Open

Support default type parameters in Generic#795
GruffElixir wants to merge 3 commits into
python:mainfrom
GruffElixir:fix/typevar-defaults

Conversation

@GruffElixir

Copy link
Copy Markdown

Fixes #672

On Python 3.9–3.12, typing's generic specialization path does not invoke the default-substitution hooks exposed by typing_extensions.TypeVar. Apply those hooks for generic classes and aliases before delegating to typing, so omitted parameters use their declared defaults.

Tests: Python 3.9 and 3.10 python -m unittest test_typing_extensions.TypeVarLikeDefaultsTests; Python 3.14 same.

Copilot AI lite review requested due to automatic review settings September 8, 2026 12:12
@python-cla-bot

python-cla-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.82609% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.24%. Comparing base (3ae9b75) to head (7c49d9b).

Files with missing lines Patch % Lines
src/typing_extensions.py 97.56% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main     #795      +/-   ##
==========================================
- Coverage   97.26%   97.24%   -0.03%     
==========================================
  Files           3        3              
  Lines        7859     7905      +46     
==========================================
+ Hits         7644     7687      +43     
- Misses        215      218       +3     
Flag Coverage Δ
3.10 88.89% <91.30%> (+0.03%) ⬆️
3.10.4 88.89% <91.30%> (+0.03%) ⬆️
3.11 88.04% <91.30%> (+0.01%) ⬆️
3.11.0 87.29% <91.30%> (+0.02%) ⬆️
3.12 87.99% <93.47%> (+0.03%) ⬆️
3.12.0 87.98% <93.47%> (+0.03%) ⬆️
3.13 82.98% <13.04%> (-0.41%) ⬇️
3.13.0 83.67% <13.04%> (-0.42%) ⬇️
3.14 79.13% <13.04%> (-0.40%) ⬇️
3.9 89.51% <84.78%> (-0.03%) ⬇️
3.9.12 89.51% <84.78%> (-0.03%) ⬇️
pypy3.10 88.72% <91.30%> (+0.04%) ⬆️
pypy3.11 87.90% <91.30%> (+0.01%) ⬆️
pypy3.9 89.34% <84.78%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/test_typing_extensions.py 98.23% <100.00%> (+<0.01%) ⬆️
src/typing_extensions.py 93.97% <97.56%> (-0.03%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: typing_extensions.Generic not support TypeVar defaults

2 participants